<template>
	<view class="aydetails">
		<!-- 头部 -->
		<view class="aydetails_head">
			<view class="aydetails_image">
				<image mode="aspectFill" src="../../static/my/portrait.png"></image>
			</view>
			<view class="head_bos">
				<view class="head_name">
					<view class="font17 font-323232 font-b">{{detailsobj.user_the_patient_info.name}}</view>
				</view>
				<view class="head_box">
					<view>{{detailsobj.user_the_patient_info.age}}岁</view>
					<text></text>
					<view>{{detailsobj.user_the_patient_info.sex==1?'男':'女'}}</view>
				</view>
				<view class="jobnumber" v-if="detailsobj.consultation_consult_name">
					<view class="jobnumber_tltle font14 font-969696">咨询目的:</view>
					<view class="jobnumber_last">{{detailsobj.consultation_consult_name}}</view>
				</view>
			</view>
		</view>
		<!-- 问题描述 -->
		<view class="aydetails_me" v-if="detailsobj.content">
			<text class="title">问题描述</text>
			<view class="font14 font-969696">{{detailsobj.content}}</view>
		</view>
		<!-- 图片详情 -->
		<view class="demeanor" v-if="imglist.length>0">
			<view class="title title_padding">图片详情</view>
			<view class="demeanor_bos">
				<image mode="aspectFill" :src="item" @click="Onbanner(index)" v-for="(item,index) in imglist" :key="index" class="demeanor_list"></image>
			</view>
		</view>
		<!-- 其它信息 -->
		<view class="aydetails_info">
			<text class="title">其它信息</text>
			<view class="info_bos">
				<view class="info_box">
					<view>订单时间</view>
					<text>{{detailsobj.createtime}}</text>
				</view>
				<view class="info_box">
					<view>订单金额</view>
					<text>￥{{detailsobj.total_money}}</text>
				</view>
				<view class="info_box">
					<view>优惠券</view>
					<text>-￥{{detailsobj.coupon_price}}</text>
				</view>
				<view class="info_box">
					<view>支付金额</view>
					<text>￥{{detailsobj.money}}</text>
				</view>
				<view class="info_box">
					<view>支付状态</view>
					<text>{{detailsobj.pay_status=='1'?'已支付':'已退款'}}</text>
				</view>
				<view class="info_box">
					<view>订单状态</view>
					<text>{{detailsobj.status == 'normal'?'待接诊':detailsobj.status == 'refund'?'已退款':detailsobj.status == 'refuse_patient'?'拒绝接诊':detailsobj.status == 'patient'?'接诊中':'接诊完成'}}</text>
				</view>
				<view class="info_box">
					<view>接诊时间</view>
					<text>{{detailsobj.patient_time?detailsobj.patient_time:'未接诊'}}</text>
				</view>
				<view class="info_box">
					<view>支付时间</view>
					<text>{{detailsobj.pay_time}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad(options) {
			this.id = options.id
			this.type = options.type
			//详情
			this.Ondetails()
		},
		data() {
			return {
				id: null,
				type: '',
				detailsobj: {}, //数据
				imglist: [], //图片
			}
		},
		methods: {
			//详情
			Ondetails() {
				let url = ''
				if (this.type == 'tw') {
					url = 'doctordetailsConsultationOrder'
				}
				if (this.type == 'sp') {
					url = 'doctordetailsConsultationVideoOrder'
				}
				if (this.type == 'report') {
					url = 'doctordetailsConsultationReportOrder'
				}
				this.$Http({
					url: url,
					data: {
						order_id: this.id
					},
				}).then(res => {
					if (res.code == 1) {
						res.data.patient_time = res.data.patient_time?this.$base.formatTime(new Date(res.data.patient_time *1000), "yyyy/MM/dd hh:mm:ss"):''
						res.data.createtime = this.$base.formatTime(new Date(res.data.createtime *1000), "yyyy/MM/dd hh:mm:ss")
						res.data.pay_time = this.$base.formatTime(new Date(res.data.pay_time *1000), "yyyy/MM/dd hh:mm:ss")
						res.data.user_the_patient_info.age = this.$base.Onage(res.data.user_the_patient_info.birthday)

						this.detailsobj = res.data
						if(res.data.images[0] == ""){
							this.imglist = []
						}else{
							res.data.images.forEach(item=>{
								if(item != ""){
									this.imglist.push(item)
								}
							})
							// this.imglist = res.data.images
						}
					}
				});
			},
			//放大图片
			Onbanner(e) {
				uni.previewImage({
					current: e, //预览图片的下标
					urls: this.imglist //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			}
		}
	}
</script>

<style>
	.aydetails {
		padding-bottom: 180rpx;
	}

	/* 标题 */
	.title {
		font-size: 34rpx;
		color: #323232;
		font-weight: 700;
	}

	.title_padding {
		padding-left: 35rpx;
	}

	/* 头部 */
	.aydetails_head {
		width: 690rpx;
		height: 256rpx;
		background-color: #ffffff;
		box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(213, 213, 213, 0.5);
		border-radius: 5rpx;
		margin: 30rpx 30rpx 0 30rpx;
		display: flex;
		align-items: center;
	}

	.aydetails_image {
		width: 244rpx;
		height: 150rpx;
		display: flex;
		justify-content: center;
	}

	.aydetails_image image {
		width: 150rpx;
		height: 150rpx;
		border-radius: 75rpx;
	}

	.head_bos {
		width: 446rpx;
		height: 150rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.head_name {
		display: flex;
		align-items: center;
	}

	.head_box {
		display: flex;
		align-items: center;
		font-size: 28rpx;
		color: #646464;
	}

	.head_box text {
		display: block;
		width: 2rpx;
		height: 21rpx;
		background-color: #c8c8c8;
		margin-left: 20rpx;
		margin-right: 20rpx;
	}

	.jobnumber {
		display: flex;
		align-items: center;
	}

	.jobnumber_last {
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 2rpx;
		height: 30rpx;
		font-size: 20rpx;
		padding: 0 8rpx;
		margin-left: 5rpx;
		border: solid 1rpx #6ccbb6;
		color: #6bcbb6;
	}

	/* 问题描述 */
	.aydetails_me {
		padding: 0 35rpx;
		margin-top: 70rpx;
	}

	.aydetails_me view {
		margin-top: 30rpx;
	}

	/* 图片详情 */
	.demeanor {
		width: 750rpx;
		/* padding: 0 35rpx; */
		margin-top: 68rpx;
	}

	.demeanor_bos {
		width: 750rpx;
		padding: 0 35rpx;
		display: flex;
		flex-wrap: wrap;
	}

	.demeanor_list {
		width: 212rpx;
		height: 212rpx;
		background-color: #ffffff;
		border-radius: 5rpx;
		margin-top: 42rpx;
		margin-right: 20rpx;
	}

	.demeanor_list:nth-of-type(3n) {
		margin-right: 0rpx;
	}

	/* 其它信息 */
	.aydetails_info {
		width: 750rpx;
		padding: 0 35rpx;
		margin-top: 68rpx;
	}

	.info_bos {
		width: 680rpx;
		background-color: #ffffff;
		box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(213, 213, 213, 0.5);
		border-radius: 5rpx;
		margin-top: 30rpx;
		padding: 30rpx 40rpx 50rpx 40rpx;
	}

	.info_box {
		display: flex;
		align-items: center;
		width: 600rpx;
		margin-top: 28rpx;
	}

	.info_box view {
		width: 120rpx;
		font-size: 28rpx;
		color: #323232;
	}

	.info_box text {
		display: block;
		width: 480rpx;
		font-size: 28rpx;
		color: #969696;
	}
</style>
